package com.tedu.egmvcboot.result;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class JsonResult {
    private Integer statusCode;
    private String message;
    private Object data;
    /*public JsonResult(Integer statusCode, String message){
        this.statusCode=statusCode;
        this.message=message;
    }*/
    public JsonResult(Status status){
        this.statusCode=status.getStatusCode();
        this.message=status.getMessage();
        //this.JsonResult(status,null);
    }
    public JsonResult(Status status,Object data){
        this.statusCode=status.getStatusCode();
        this.message=status.getMessage();
        this.data=data;
    }
    public static JsonResult success(){
        return new JsonResult(Status.OPERATION_SUCCESS);
    }
    public static JsonResult success(Object data){
        return new JsonResult(Status.OPERATION_SUCCESS,data);
    }
}
